﻿namespace SocialFront.Core.Persistence
{
    public class SocialFrontDataContextFactory
    {
        // TODO - Create a const file to store strings.
        private const string CraftTraxStorageKey = "SF_Ctx";

        public static SocialFrontContext GetDataContext()
        {
            var storage = DataContextStorageFactory.GetStorage();
            var context = storage.Get<SocialFrontContext>(CraftTraxStorageKey);

            if (context == null)
            {
                context = new SocialFrontContext();
                storage.Add(CraftTraxStorageKey, context);
            }
            return context;
        }

        public static void RemoveDataContext()
        {
            DataContextStorageFactory.GetStorage().Remove(CraftTraxStorageKey);
        }
    }
}
